<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>02DOM练习</title>
</head>
<body>
    <h1>我是标题:<span class="s"></span></h1>
    <input type="text" id="i1">
    <input type="text" id="i2">
    <button onclick="f1()">按钮</button>
    <button onclick="f2()">按钮2</button>
    <script>
        function f1(){
            //根据类选择器获取span中的元素
            let spanE = document.querySelector('.s');
            console.log(spanE);
            //设置span内的文字
            spanE.innerHTML = '哈哈哈';
        }
        function f2(){
            let input1 = document.querySelector('#i1');
            let input2 = document.getElementById('i2');
            console.log(input1.value);
            console.log(typeof input2.value);
            let i2 = parseFloat(input2.value);
            console.log(i2,typeof i2);
        }
    </script>
</body>
</html>